package Io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
/**
 * 使用流连接完成PW的创建
 */
public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pw2.txt", true);
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw);

        Scanner sc = new Scanner(System.in);

        while (true){
            String data = sc.nextLine();
            if("exit".equalsIgnoreCase(data)){ //判断是否为exit  是就退出输入
                break;
        }
        pw.println(data);
        }
        pw.close();
    }
}
